#!/usr/local/bin/python
# -*- coding: gbk -*-
#============================================================
# JPG2PNG.PY          -- by Dr. ZhuoQing 2021-06-06
#
# Note:
#============================================================

from head import *
from PIL                    import Image

filename = r'd:\temp\1.jpg'
outfile = r'd:\temp\1.png'

#------------------------------------------------------------
pastestr = clipboard.paste()
if os.path.isfile(pastestr):
    filename = pastestr
    outfile = '.'.join(filename.split('.')[:-1]) + '.png'

if len(sys.argv) > 1:
    if os.path.isfile(sys.argv[1]):
        filename = sys.argv[1]
        outfile = '.'.join(filename.split('.')[:-1]) + '.png'

printf("Change file %s-->%s\a"%(filename, outfile))
#------------------------------------------------------------
im = Image.open(filename)
im.save(outfile)

clipboard.copy("")

#------------------------------------------------------------
#        END OF FILE : JPG2PNG.PY
#============================================================